#!/bin/bash

cd $(dirname $0)

mkdir -p ~/autossh/
cp -f ./autossh ~/autossh/

CONFIG_FILE=`cd ~/autossh/ && pwd`/config.json
if [[ ! -f ${CONFIG_FILE} ]]; then
    cp ./config.json ~/autossh/
fi

HAS_ALIAS=`cat ~/.bash_profile | grep autossh | wc -l`
if [[ ${HAS_ALIAS} -eq 0 ]]; then
    echo "export PATH=$PATH:~/autossh/" >> ~/.bash_profile
fi

source ~/.bash_profile

~/autossh/autossh
